3.668 \(\int (a+i a \tan (e+f x)) (A+B \tan (e+f x)) (c-i c \tan (e+f x))^2 \, dx\)

Optimal. Leaf size=66 \[ -\frac{a c^2 (-B+i A) \tan ^2(e+f x)}{2 f}+\frac{a A c^2 \tan (e+f x)}{f}-\frac{i a B c^2 \tan ^3(e+f x)}{3 f} \]

[Out]

(a*A*c^2*Tan[e + f*x])/f - (a*(I*A - B)*c^2*Tan[e + f*x]^2)/(2*f) - ((I/3)*a*B*c^2*Tan[e + f*x]^3)/f

________________________________________________________________________________________

Rubi [A]  time = 0.0852537, antiderivative size = 66, normalized size of antiderivative = 1., number of steps used = 3, number of rules used = 2, integrand size = 39, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.051, Rules used = {3588, 43} \[ -\frac{a c^2 (-B+i A) \tan ^2(e+f x)}{2 f}+\frac{a A c^2 \tan (e+f x)}{f}-\frac{i a B c^2 \tan ^3(e+f x)}{3 f} \]

Antiderivative was successfully verified.

[In]

Int[(a + I*a*Tan[e + f*x])*(A + B*Tan[e + f*x])*(c - I*c*Tan[e + f*x])^2,x]

[Out]

(a*A*c^2*Tan[e + f*x])/f - (a*(I*A - B)*c^2*Tan[e + f*x]^2)/(2*f) - ((I/3)*a*B*c^2*Tan[e + f*x]^3)/f

Rule 3588

Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_.)*((A_.) + (B_.)*tan[(e_.) + (f_.)*(x_)])*((c_) + (d_.)*tan[(e_
.) + (f_.)*(x_)])^(n_.), x_Symbol] :> Dist[(a*c)/f, Subst[Int[(a + b*x)^(m - 1)*(c + d*x)^(n - 1)*(A + B*x), x
], x, Tan[e + f*x]], x] /; FreeQ[{a, b, c, d, e, f, A, B, m, n}, x] && EqQ[b*c + a*d, 0] && EqQ[a^2 + b^2, 0]

Rule 43

Int[((a_.) + (b_.)*(x_))^(m_.)*((c_.) + (d_.)*(x_))^(n_.), x_Symbol] :> Int[ExpandIntegrand[(a + b*x)^m*(c + d
*x)^n, x], x] /; FreeQ[{a, b, c, d, n}, x] && NeQ[b*c - a*d, 0] && IGtQ[m, 0] && ( !IntegerQ[n] || (EqQ[c, 0]
&& LeQ[7*m + 4*n + 4, 0]) || LtQ[9*m + 5*(n + 1), 0] || GtQ[m + n + 2, 0])

Rubi steps

\begin{align*} \int (a+i a \tan (e+f x)) (A+B \tan (e+f x)) (c-i c \tan (e+f x))^2 \, dx &=\frac{(a c) \operatorname{Subst}(\int (A+B x) (c-i c x) \, dx,x,\tan (e+f x))}{f}\\ &=\frac{(a c) \operatorname{Subst}\left (\int \left (A c+(-i A+B) c x-i B c x^2\right ) \, dx,x,\tan (e+f x)\right )}{f}\\ &=\frac{a A c^2 \tan (e+f x)}{f}-\frac{a (i A-B) c^2 \tan ^2(e+f x)}{2 f}-\frac{i a B c^2 \tan ^3(e+f x)}{3 f}\\ \end{align*}

Mathematica [A]  time = 2.34587, size = 109, normalized size = 1.65 \[ \frac{a c^2 \sec (e) \sec ^3(e+f x) (3 (B-i A) \cos (2 e+f x)+3 (B-i A) \cos (f x)-3 A \sin (2 e+f x)+3 A \sin (2 e+3 f x)+6 A \sin (f x)-3 i B \sin (2 e+f x)+i B \sin (2 e+3 f x))}{12 f} \]

Antiderivative was successfully verified.

[In]

Integrate[(a + I*a*Tan[e + f*x])*(A + B*Tan[e + f*x])*(c - I*c*Tan[e + f*x])^2,x]

[Out]

(a*c^2*Sec[e]*Sec[e + f*x]^3*(3*((-I)*A + B)*Cos[f*x] + 3*((-I)*A + B)*Cos[2*e + f*x] + 6*A*Sin[f*x] - 3*A*Sin
[2*e + f*x] - (3*I)*B*Sin[2*e + f*x] + 3*A*Sin[2*e + 3*f*x] + I*B*Sin[2*e + 3*f*x]))/(12*f)

________________________________________________________________________________________

Maple [A]  time = 0.012, size = 53, normalized size = 0.8 \begin{align*}{\frac{a{c}^{2}}{f} \left ( -{\frac{i}{3}}B \left ( \tan \left ( fx+e \right ) \right ) ^{3}-{\frac{i}{2}}A \left ( \tan \left ( fx+e \right ) \right ) ^{2}+{\frac{B \left ( \tan \left ( fx+e \right ) \right ) ^{2}}{2}}+A\tan \left ( fx+e \right ) \right ) } \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((a+I*a*tan(f*x+e))*(A+B*tan(f*x+e))*(c-I*c*tan(f*x+e))^2,x)

[Out]

1/f*a*c^2*(-1/3*I*B*tan(f*x+e)^3-1/2*I*A*tan(f*x+e)^2+1/2*B*tan(f*x+e)^2+A*tan(f*x+e))

________________________________________________________________________________________

Maxima [A]  time = 1.72229, size = 74, normalized size = 1.12 \begin{align*} \frac{-2 i \, B a c^{2} \tan \left (f x + e\right )^{3} - 3 \,{\left (i \, A - B\right )} a c^{2} \tan \left (f x + e\right )^{2} + 6 \, A a c^{2} \tan \left (f x + e\right )}{6 \, f} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+I*a*tan(f*x+e))*(A+B*tan(f*x+e))*(c-I*c*tan(f*x+e))^2,x, algorithm="maxima")

[Out]

1/6*(-2*I*B*a*c^2*tan(f*x + e)^3 - 3*(I*A - B)*a*c^2*tan(f*x + e)^2 + 6*A*a*c^2*tan(f*x + e))/f

________________________________________________________________________________________

Fricas [A]  time = 1.28905, size = 201, normalized size = 3.05 \begin{align*} \frac{{\left (6 i \, A + 6 \, B\right )} a c^{2} e^{\left (2 i \, f x + 2 i \, e\right )} +{\left (6 i \, A - 2 \, B\right )} a c^{2}}{3 \,{\left (f e^{\left (6 i \, f x + 6 i \, e\right )} + 3 \, f e^{\left (4 i \, f x + 4 i \, e\right )} + 3 \, f e^{\left (2 i \, f x + 2 i \, e\right )} + f\right )}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+I*a*tan(f*x+e))*(A+B*tan(f*x+e))*(c-I*c*tan(f*x+e))^2,x, algorithm="fricas")

[Out]

1/3*((6*I*A + 6*B)*a*c^2*e^(2*I*f*x + 2*I*e) + (6*I*A - 2*B)*a*c^2)/(f*e^(6*I*f*x + 6*I*e) + 3*f*e^(4*I*f*x +
4*I*e) + 3*f*e^(2*I*f*x + 2*I*e) + f)

________________________________________________________________________________________

Sympy [B]  time = 5.57772, size = 114, normalized size = 1.73 \begin{align*} \frac{\frac{\left (2 i A a c^{2} + 2 B a c^{2}\right ) e^{- 4 i e} e^{2 i f x}}{f} + \frac{\left (6 i A a c^{2} - 2 B a c^{2}\right ) e^{- 6 i e}}{3 f}}{e^{6 i f x} + 3 e^{- 2 i e} e^{4 i f x} + 3 e^{- 4 i e} e^{2 i f x} + e^{- 6 i e}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+I*a*tan(f*x+e))*(A+B*tan(f*x+e))*(c-I*c*tan(f*x+e))**2,x)

[Out]

((2*I*A*a*c**2 + 2*B*a*c**2)*exp(-4*I*e)*exp(2*I*f*x)/f + (6*I*A*a*c**2 - 2*B*a*c**2)*exp(-6*I*e)/(3*f))/(exp(
6*I*f*x) + 3*exp(-2*I*e)*exp(4*I*f*x) + 3*exp(-4*I*e)*exp(2*I*f*x) + exp(-6*I*e))

________________________________________________________________________________________

Giac [A]  time = 1.50044, size = 126, normalized size = 1.91 \begin{align*} \frac{6 i \, A a c^{2} e^{\left (2 i \, f x + 2 i \, e\right )} + 6 \, B a c^{2} e^{\left (2 i \, f x + 2 i \, e\right )} + 6 i \, A a c^{2} - 2 \, B a c^{2}}{3 \,{\left (f e^{\left (6 i \, f x + 6 i \, e\right )} + 3 \, f e^{\left (4 i \, f x + 4 i \, e\right )} + 3 \, f e^{\left (2 i \, f x + 2 i \, e\right )} + f\right )}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+I*a*tan(f*x+e))*(A+B*tan(f*x+e))*(c-I*c*tan(f*x+e))^2,x, algorithm="giac")

[Out]

1/3*(6*I*A*a*c^2*e^(2*I*f*x + 2*I*e) + 6*B*a*c^2*e^(2*I*f*x + 2*I*e) + 6*I*A*a*c^2 - 2*B*a*c^2)/(f*e^(6*I*f*x
+ 6*I*e) + 3*f*e^(4*I*f*x + 4*I*e) + 3*f*e^(2*I*f*x + 2*I*e) + f)